
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>5.3.1 Value 类型---1 · 大数据 bigdata_spark_atguigu 课堂笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content=" 李振超">
        
        
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-prism/prism-solarizedlight.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-change_girls/girls.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../../styles/website.css">
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="531-value-lei-xing-2.html" />
    
    
    <link rel="prev" href="../53-rdd-de-zhuan-huan.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.atguigu.com/" target="_blank" class="custom-link">联系我们</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        <li class="header">第 1 部分 Spark 基础</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                    第 1 章 Spark 概述
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../../../11-shi-yao-shi-spark.html">
            
                <a href="../../../11-shi-yao-shi-spark.html">
            
                    
                    1.1 什么是 Spark
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="../../../13-spark-te-dian.html">
            
                <a href="../../../13-spark-te-dian.html">
            
                    
                    1.2 Spark 特点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3" data-path="../../../13-spark-nei-zhi-mo-kuai-jie-shao.html">
            
                <a href="../../../13-spark-nei-zhi-mo-kuai-jie-shao.html">
            
                    
                    1.3 Spark 内置模块介绍
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../../chapter1.html">
            
                <a href="../../../chapter1.html">
            
                    
                    第 2 章 Spark 运行模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../../chapter1/21-local-mo-shi.html">
            
                <a href="../../../chapter1/21-local-mo-shi.html">
            
                    
                    2.1 Local 模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../../chapter1/22-spark-he-xin-gai-nian-jie-shao.html">
            
                <a href="../../../chapter1/22-spark-he-xin-gai-nian-jie-shao.html">
            
                    
                    2.2 Spark 核心概念介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../../chapter1/22-standalone-mo-shi.html">
            
                <a href="../../../chapter1/22-standalone-mo-shi.html">
            
                    
                    2.3 Standalone 模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.3.1" data-path="../../../chapter1/231-pei-zhi-standalone-mo-shi.html">
            
                <a href="../../../chapter1/231-pei-zhi-standalone-mo-shi.html">
            
                    
                    2.3.1 配置 Standalone 模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.2" data-path="../../../chapter1/232-shi-yong-standalone-mo-shi-yun-xing-ji-suan-pi-de-cheng-xu.html">
            
                <a href="../../../chapter1/232-shi-yong-standalone-mo-shi-yun-xing-ji-suan-pi-de-cheng-xu.html">
            
                    
                    2.3.2 使用 Standalone 模式运行计算 PI 的程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.3" data-path="../../../chapter1/233-zai-standalone-mo-shi-xia-qi-dong-spark-shell.html">
            
                <a href="../../../chapter1/233-zai-standalone-mo-shi-xia-qi-dong-spark-shell.html">
            
                    
                    2.3.3 在 Standalone 模式下启动 Spark-shell
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.4" data-path="../../../chapter1/24-pei-zhi-spark-ren-wu-li-shi-fu-wu-qi.html">
            
                <a href="../../../chapter1/24-pei-zhi-spark-ren-wu-li-shi-fu-wu-qi.html">
            
                    
                    2.3.4 配置 Spark 任务历史服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.5" data-path="../../../chapter1/25-ha-pei-7f6e28-wei-mater-pei-7f6e29.html">
            
                <a href="../../../chapter1/25-ha-pei-7f6e28-wei-mater-pei-7f6e29.html">
            
                    
                    2.3.5 HA 配置(为 Mater 配置)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.6" data-path="../../../chapter1/233-standalone-gong-zuo-mo-shi-tu-jie.html">
            
                <a href="../../../chapter1/233-standalone-gong-zuo-mo-shi-tu-jie.html">
            
                    
                    2.3.6 Standalone 工作模式图解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../../../chapter1/24-yarn-mo-shi.html">
            
                <a href="../../../chapter1/24-yarn-mo-shi.html">
            
                    
                    2.4 Yarn 模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../../../chapter1/25-mesos-mo-shi.html">
            
                <a href="../../../chapter1/25-mesos-mo-shi.html">
            
                    
                    2.5 Mesos 模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../../../chapter1/26-ji-zhong-yun-xing-mo-shi-de-dui-bi.html">
            
                <a href="../../../chapter1/26-ji-zhong-yun-xing-mo-shi-de-dui-bi.html">
            
                    
                    2.6 几种运行模式的对比
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../../di-3-zhang-an-li-shi-cao.html">
            
                <a href="../../../di-3-zhang-an-li-shi-cao.html">
            
                    
                    第 3 章 案例实操
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../../di-3-zhang-an-li-shi-cao/31-bian-xie-wordcount-cheng-xu.html">
            
                <a href="../../../di-3-zhang-an-li-shi-cao/31-bian-xie-wordcount-cheng-xu.html">
            
                    
                    3.1 编写 WordCount 程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../../di-3-zhang-an-li-shi-cao/32-ce-shi.html">
            
                <a href="../../../di-3-zhang-an-li-shi-cao/32-ce-shi.html">
            
                    
                    3.2 测试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">第 2 部分 Spark Core</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../../di-4-zhang-rdd-gai-shu.html">
            
                <a href="../../di-4-zhang-rdd-gai-shu.html">
            
                    
                    第 4 章 RDD 概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../../di-5-zhang-rdd-bian-cheng.html">
            
                <a href="../../di-5-zhang-rdd-bian-cheng.html">
            
                    
                    第 5 章 RDD 编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../51-rdd-bian-cheng-mo-xing.html">
            
                <a href="../51-rdd-bian-cheng-mo-xing.html">
            
                    
                    5.1 RDD 编程模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="../52-rdd-de-chuang-jian.html">
            
                <a href="../52-rdd-de-chuang-jian.html">
            
                    
                    5.2 RDD 的创建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="../53-rdd-de-zhuan-huan.html">
            
                <a href="../53-rdd-de-zhuan-huan.html">
            
                    
                    5.3 RDD 的转换(transformation)
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="2.2.3.1" data-path="531-value-lei-xing.html">
            
                <a href="531-value-lei-xing.html">
            
                    
                    5.3.1 Value 类型---1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3.2" data-path="531-value-lei-xing-2.html">
            
                <a href="531-value-lei-xing-2.html">
            
                    
                    5.3.1 Value 类型---2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3.3" data-path="532-shuang-value-lei-xing.html">
            
                <a href="532-shuang-value-lei-xing.html">
            
                    
                    5.3.2 双 Value 类型交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3.4" data-path="533-key-value-lei-xing.html">
            
                <a href="533-key-value-lei-xing.html">
            
                    
                    5.3.3 Key-Value 类型--1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3.5" data-path="533-key-value-lei-578b-2.html">
            
                <a href="533-key-value-lei-578b-2.html">
            
                    
                    5.3.3 Key-Value 类型---2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3.6" data-path="534-an-li-shi-cao.html">
            
                <a href="534-an-li-shi-cao.html">
            
                    
                    5.3.4 案例实操
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2.4" data-path="../54-rddde-action-cao-zuo.html">
            
                <a href="../54-rddde-action-cao-zuo.html">
            
                    
                    5.4 RDD的 Action 操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.5" data-path="../55-rdd-zhong-han-shu-de-chuan-di.html">
            
                <a href="../55-rdd-zhong-han-shu-de-chuan-di.html">
            
                    
                    5.5 RDD 中函数的传递
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.6" data-path="../56-rdd-de-yi-lai-guan-xi.html">
            
                <a href="../56-rdd-de-yi-lai-guan-xi.html">
            
                    
                    5.6 RDD 的依赖关系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.7" data-path="../57-spark-zhong-de-job-diao-du.html">
            
                <a href="../57-spark-zhong-de-job-diao-du.html">
            
                    
                    5.7 Spark 中的 Job 调度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.8" data-path="../58-spark-job-de-hua-fen.html">
            
                <a href="../58-spark-job-de-hua-fen.html">
            
                    
                    5.8 Spark Job 的划分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.9" data-path="../50-rdd-de-chi-jiu-hua.html">
            
                <a href="../50-rdd-de-chi-jiu-hua.html">
            
                    
                    5.9 RDD 的持久化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.10" data-path="../510-she-zhi-jian-cha-dian.html">
            
                <a href="../510-she-zhi-jian-cha-dian.html">
            
                    
                    5.10 设置检查点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../../di-6-zhang-key-value-lei-xing-rdd-de-shu-ju-fen-qu.html">
            
                <a href="../../di-6-zhang-key-value-lei-xing-rdd-de-shu-ju-fen-qu.html">
            
                    
                    第 6 章 Key-Value 类型 RDD 的数据分区器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../../di-7-zhang.html">
            
                <a href="../../di-7-zhang.html">
            
                    
                    第 7 章 文件中数据的读取和保存
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../../di-7-zhang/71-du-xie-text-wen-jian.html">
            
                <a href="../../di-7-zhang/71-du-xie-text-wen-jian.html">
            
                    
                    7.1 读写 Text 文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="../../di-7-zhang/72-du-xie-json-wen-jian.html">
            
                <a href="../../di-7-zhang/72-du-xie-json-wen-jian.html">
            
                    
                    7.2 读写 Json 文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.3" data-path="../../di-7-zhang/73-du-xie-sequence-wen-jian.html">
            
                <a href="../../di-7-zhang/73-du-xie-sequence-wen-jian.html">
            
                    
                    7.3 读写 Sequence 文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.4" data-path="../../di-7-zhang/74-du-xie-object-wen-jian.html">
            
                <a href="../../di-7-zhang/74-du-xie-object-wen-jian.html">
            
                    
                    7.4 读写 Object 文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.5" data-path="../../di-7-zhang/75-cong-hdfs-du-xie-wen-jian.html">
            
                <a href="../../di-7-zhang/75-cong-hdfs-du-xie-wen-jian.html">
            
                    
                    7.5 从 HDFS 读写文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.6" data-path="../../di-7-zhang/76-cong-mysql-shu-ju-du-xie-wen-jian.html">
            
                <a href="../../di-7-zhang/76-cong-mysql-shu-ju-du-xie-wen-jian.html">
            
                    
                    7.6 从 Mysql 数据读写文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.7" data-path="../../di-7-zhang/77-cong-hbase-du-xie-wen-jian.html">
            
                <a href="../../di-7-zhang/77-cong-hbase-du-xie-wen-jian.html">
            
                    
                    7.7 从 Hbase 读写文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../../di-8-zhang-rdd-bian-cheng-jin-jie.html">
            
                <a href="../../di-8-zhang-rdd-bian-cheng-jin-jie.html">
            
                    
                    第 8 章 RDD 编程进阶
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../../di-8-zhang-rdd-bian-cheng-jin-jie/81-lei-jia-qi.html">
            
                <a href="../../di-8-zhang-rdd-bian-cheng-jin-jie/81-lei-jia-qi.html">
            
                    
                    8.1 累加器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.2" data-path="../../di-8-zhang-rdd-bian-cheng-jin-jie/82-guang-bo-bian-liang.html">
            
                <a href="../../di-8-zhang-rdd-bian-cheng-jin-jie/82-guang-bo-bian-liang.html">
            
                    
                    8.2 广播变量
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">第 3 部分 Spark Core 项目实战</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../../../di-3-bu-fen-spark-core-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju.html">
            
                <a href="../../../di-3-bu-fen-spark-core-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju.html">
            
                    
                    第 1 章 准备数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../../../di-3-bu-fen-spark-core-xiang-mu-shi-zhan/di-2-zhang-xu-qiu-1-top10-re-men-pin-lei.html">
            
                <a href="../../../di-3-bu-fen-spark-core-xiang-mu-shi-zhan/di-2-zhang-xu-qiu-1-top10-re-men-pin-lei.html">
            
                    
                    第 2 章 需求 1: Top10 热门品类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../../../di-3-bu-fen-spark-core-xiang-mu-shi-zhan/di-3-zhang-xu-qiu-2-top10-re-men-pin-leizhong-mei-ge-pin-lei-de-top10-huo-yue-session-tong-ji.html">
            
                <a href="../../../di-3-bu-fen-spark-core-xiang-mu-shi-zhan/di-3-zhang-xu-qiu-2-top10-re-men-pin-leizhong-mei-ge-pin-lei-de-top10-huo-yue-session-tong-ji.html">
            
                    
                    第 3 章 需求 2: Top10热门品类中每个品类的 Top10 活跃 Session 统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../../../di-3-bu-fen-spark-core-xiang-mu-shi-zhan/di-4-zhang-xu-qiu-3-ye-mian-dan-tiao-zhuan-hua-lv-tong-ji.html">
            
                <a href="../../../di-3-bu-fen-spark-core-xiang-mu-shi-zhan/di-4-zhang-xu-qiu-3-ye-mian-dan-tiao-zhuan-hua-lv-tong-ji.html">
            
                    
                    第 4 章 需求 3: 页面单跳转化率统计
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第 4 部分 Spark Sql</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu.html">
            
                    
                    第 9 章 Spark SQL 概述
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu/91-11-shi-yao-shi-spark-sql.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu/91-11-shi-yao-shi-spark-sql.html">
            
                    
                    9.1  什么是 Spark SQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu/92-spark-sql-de-te-dian.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu/92-spark-sql-de-te-dian.html">
            
                    
                    9.2 Spark SQL 的特点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3" data-path="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu/93-shi-yao-shi-dataframe.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu/93-shi-yao-shi-dataframe.html">
            
                    
                    9.3 什么是 DataFrame
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4" data-path="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu/94-shi-yao-shi-dataset.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-9-zhang-spark-sql-gai-shu/94-shi-yao-shi-dataset.html">
            
                    
                    9.4 什么是 DataSet
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng.html">
            
                    
                    第 10 章 Spark SQL 编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/101-sparksession.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/101-sparksession.html">
            
                    
                    10.1 SparkSession
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.2" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/102-shi-yong-dataframe-jin-xing-bian-cheng.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/102-shi-yong-dataframe-jin-xing-bian-cheng.html">
            
                    
                    10.2 使用 DataFrame 进行编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.2.1" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/102-shi-yong-dataframe-jin-xing-bian-cheng/1021-chuang-jian-dataframe.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/102-shi-yong-dataframe-jin-xing-bian-cheng/1021-chuang-jian-dataframe.html">
            
                    
                    10.2.1 创建 DataFrame
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.2.2" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/102-shi-yong-dataframe-jin-xing-bian-cheng/1022-dataframe-yu-fa-feng-ge.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/102-shi-yong-dataframe-jin-xing-bian-cheng/1022-dataframe-yu-fa-feng-ge.html">
            
                    
                    10.2.2 DataFrame 语法风格
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.2.3" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/102-shi-yong-dataframe-jin-xing-bian-cheng/1023-rdd-zhuan-huan-wei-dataframe.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/102-shi-yong-dataframe-jin-xing-bian-cheng/1023-rdd-zhuan-huan-wei-dataframe.html">
            
                    
                    10.2.3 RDD 和 DataFrame 的交互
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.2.3" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/103-shi-yong-dataset-jin-xing-bian-cheng.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/103-shi-yong-dataset-jin-xing-bian-cheng.html">
            
                    
                    10.3 使用 DataSet 进行编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.3.1" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/103-shi-yong-dataset-jin-xing-bian-cheng/1031-chuang-jian-dataset.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/103-shi-yong-dataset-jin-xing-bian-cheng/1031-chuang-jian-dataset.html">
            
                    
                    10.3.1 创建 DataSet
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.3.2" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/103-shi-yong-dataset-jin-xing-bian-cheng/1032-rdd-he-dataset-de-jiao-hu.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/103-shi-yong-dataset-jin-xing-bian-cheng/1032-rdd-he-dataset-de-jiao-hu.html">
            
                    
                    10.3.2 RDD 和 DataSet 的交互
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.2.4" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/104-dataframe-he-dataset-zhi-jian-de-jiao-hu.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/104-dataframe-he-dataset-zhi-jian-de-jiao-hu.html">
            
                    
                    10.4 DataFrame 和 DataSet 之间的交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.5" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/105-rdd-dataframehe-dataset-zhi-jian-de-guan-xi.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/105-rdd-dataframehe-dataset-zhi-jian-de-guan-xi.html">
            
                    
                    10.5 RDD, DataFrame和 DataSet 之间的关系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.6" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/106-shi-yong-ideachuang-jian-sparksql-cheng-xu.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/106-shi-yong-ideachuang-jian-sparksql-cheng-xu.html">
            
                    
                    10.6 使用 IDEA 创建SparkSQL 程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.7" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/107-zi-ding-yi-sparksql-han-shu.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/107-zi-ding-yi-sparksql-han-shu.html">
            
                    
                    10.7 自定义 SparkSQL 函数
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.7.1" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/107-zi-ding-yi-sparksql-han-shu/1071-zi-ding-yi-udf-han-shu.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/107-zi-ding-yi-sparksql-han-shu/1071-zi-ding-yi-udf-han-shu.html">
            
                    
                    10.7.1 自定义 UDF 函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.7.2" data-path="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/107-zi-ding-yi-sparksql-han-shu/1072-yong-hu-zi-ding-hui-ju-he-han-shu.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-10-zhang-spark-sql-bian-cheng/107-zi-ding-yi-sparksql-han-shu/1072-yong-hu-zi-ding-hui-ju-he-han-shu.html">
            
                    
                    10.7.2 用户自定会聚合函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan.html">
            
                    
                    第 11 章 Spark SQL 数据源
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1" data-path="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/111-tong-yong-jia-zai-he-bao-cun-han-shu.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/111-tong-yong-jia-zai-he-bao-cun-han-shu.html">
            
                    
                    11.1 通用加载和保存函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.2" data-path="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/112-jia-zai-json-wen-jian.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/112-jia-zai-json-wen-jian.html">
            
                    
                    11.2 加载 JSON 文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.3" data-path="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/113-du-qu-parquet-wen-jian.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/113-du-qu-parquet-wen-jian.html">
            
                    
                    11.3 读取 Parquet 文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.4" data-path="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/113-jdbc.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/113-jdbc.html">
            
                    
                    11.3 JDBC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.5" data-path="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/114-hive-shu-ju-ku.html">
            
                <a href="../../../di-3-bu-fen-spark-sql/di-11-zhang-spark-sql-shu-ju-yuan/114-hive-shu-ju-ku.html">
            
                    
                    11.4 Hive 数据库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">第 5 部分 SparkSql 项目实战</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../../../di-4-bu-fen-sparksql-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju.html">
            
                <a href="../../../di-4-bu-fen-sparksql-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju.html">
            
                    
                    第 1 章 准备数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../../../di-4-bu-fen-sparksql-xiang-mu-shi-zhan/di-2-zhang-xu-qiu-1-ge-qu-yu-re-men-shang-pin-top3.html">
            
                <a href="../../../di-4-bu-fen-sparksql-xiang-mu-shi-zhan/di-2-zhang-xu-qiu-1-ge-qu-yu-re-men-shang-pin-top3.html">
            
                    
                    第 2 章 需求 1: 各区域热门商品 Top3
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第 6 部分 Spark Streaming</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../../../di-4-bu-fen-spark-streaming/di-13-zhang-spark-streaming-gai-shu.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-13-zhang-spark-streaming-gai-shu.html">
            
                    
                    第 13 章 Spark Streaming 概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../../../di-4-bu-fen-spark-streaming/di-14-zhang-dstream-ru-men.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-14-zhang-dstream-ru-men.html">
            
                    
                    第 14 章 DStream 入门
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.2.1" data-path="../../../di-4-bu-fen-spark-streaming/di-14-zhang-dstream-ru-men/141-wordcount-an-li.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-14-zhang-dstream-ru-men/141-wordcount-an-li.html">
            
                    
                    14.1 wordcount 案例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2.2" data-path="../../../di-4-bu-fen-spark-streaming/di-14-zhang-dstream-ru-men/142-wordcount-an-li-jie-xi.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-14-zhang-dstream-ru-men/142-wordcount-an-li-jie-xi.html">
            
                    
                    14.2 wordcount 案例解析
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian.html">
            
                    
                    第 15 章 DStream 创建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.3.1" data-path="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/152-rdd-dui-lie.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/152-rdd-dui-lie.html">
            
                    
                    15.1 RDD 队列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.3.2" data-path="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/153-zi-ding-yi-shu-ju-yuan.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/153-zi-ding-yi-shu-ju-yuan.html">
            
                    
                    15.2 自定义数据源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.3.3" data-path="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/154-kafkashu-ju-yuan.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/154-kafkashu-ju-yuan.html">
            
                    
                    15.3 Kafka数据源
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.3.3.1" data-path="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/154-kafkashu-ju-yuan/gao-jiapi.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/154-kafkashu-ju-yuan/gao-jiapi.html">
            
                    
                    高级 API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.3.3.2" data-path="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/154-kafkashu-ju-yuan/di-ji-api.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-15-zhang-dstream-chuang-jian/154-kafkashu-ju-yuan/di-ji-api.html">
            
                    
                    低级 API
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan.html">
            
                    
                    第 16 章 DStream 转换
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.4.1" data-path="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/161-wu-zhuang-tai-zhuan-huan-cao-zuo.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/161-wu-zhuang-tai-zhuan-huan-cao-zuo.html">
            
                    
                    16.1 无状态转换操作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.4.1.1" data-path="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/161-wu-zhuang-tai-zhuan-huan-cao-zuo/1611-transform-cao-zuo.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/161-wu-zhuang-tai-zhuan-huan-cao-zuo/1611-transform-cao-zuo.html">
            
                    
                    16.1.1 transform 操作
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.4.2" data-path="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/162-you-zhuang-tai-zhuan-huan-cao-zuo.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/162-you-zhuang-tai-zhuan-huan-cao-zuo.html">
            
                    
                    16.2 有状态转换操作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.4.2.1" data-path="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/162-you-zhuang-tai-zhuan-huan-cao-zuo/1621-updatestatebykey.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/162-you-zhuang-tai-zhuan-huan-cao-zuo/1621-updatestatebykey.html">
            
                    
                    16.2.1 updateStateByKey
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4.2.2" data-path="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/162-you-zhuang-tai-zhuan-huan-cao-zuo/1622-window-cao-zuo.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-16-zhang-dstream-zhuan-huan/162-you-zhuang-tai-zhuan-huan-cao-zuo/1622-window-cao-zuo.html">
            
                    
                    16.2.2 window 操作
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="../../../di-4-bu-fen-spark-streaming/di-17-zhang-dstream-shu-chu.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-17-zhang-dstream-shu-chu.html">
            
                    
                    第 17 章 DStream 输出
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="../../../di-4-bu-fen-spark-streaming/di-18-zhang-dstream-bian-cheng-jin-jie.html">
            
                <a href="../../../di-4-bu-fen-spark-streaming/di-18-zhang-dstream-bian-cheng-jin-jie.html">
            
                    
                    第 18 章 DStream 编程进阶
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">第 7 部分 Structured Streaming</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../../../di-7-bu-fen-structured-streaming/di-1-zhang-structured-streaming-gai-shu.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-1-zhang-structured-streaming-gai-shu.html">
            
                    
                    第 1 章 Structured Streaming 概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../../../di-7-bu-fen-structured-streaming/di-2-zhang-structurestreaming-kuai-su-ru-men.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-2-zhang-structurestreaming-kuai-su-ru-men.html">
            
                    
                    第 2 章 Structure Streaming 快速入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="../../../di-7-bu-fen-structured-streaming/di-3-zhang-structured-streaming-bian-cheng-mo-xing.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-3-zhang-structured-streaming-bian-cheng-mo-xing.html">
            
                    
                    第 3 章 Structured Streaming 编程模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.3.1" data-path="../../../di-7-bu-fen-structured-streaming/di-3-zhang-structured-streaming-bian-cheng-mo-xing/31-ji-ben-gai-nian.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-3-zhang-structured-streaming-bian-cheng-mo-xing/31-ji-ben-gai-nian.html">
            
                    
                    3.1 基本概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3.2" data-path="../../../di-7-bu-fen-structured-streaming/di-3-zhang-structured-streaming-bian-cheng-mo-xing/32-chu-li-shi-4ef6-shi-jian-he-yan-chi-shu-ju.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-3-zhang-structured-streaming-bian-cheng-mo-xing/32-chu-li-shi-4ef6-shi-jian-he-yan-chi-shu-ju.html">
            
                    
                    3.2 处理事件-时间和延迟数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3.3" data-path="../../../di-7-bu-fen-structured-streaming/di-3-zhang-structured-streaming-bian-cheng-mo-xing/33-rong-cuo-yu-yi.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-3-zhang-structured-streaming-bian-cheng-mo-xing/33-rong-cuo-yu-yi.html">
            
                    
                    3.3 容错语义
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset.html">
            
                    
                    第 4 章 创建 Streaming DataFrame 和 Streaming DataSet
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.4.1" data-path="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset/41-chuang-jianstreaming-dataframes-and-streaming-datasets.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset/41-chuang-jianstreaming-dataframes-and-streaming-datasets.html">
            
                    
                    4.1 socket source
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.4.2" data-path="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset/42-file-source.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset/42-file-source.html">
            
                    
                    4.2 file source
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.4.3" data-path="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset/43-kafka-source.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset/43-kafka-source.html">
            
                    
                    4.3 Kafka source
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.4.4" data-path="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset/44-rate-source.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-4-zhang-cao-zuo-streaming-dataframe-he-streaming-dataset/44-rate-source.html">
            
                    
                    4.4 Rate Source
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset.html">
            
                    
                    第 5 章 操作 Streaming DataFrame/Streaming DataSet
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.5.1" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/51-ji-ben-cao-zuo.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/51-ji-ben-cao-zuo.html">
            
                    
                    5.1 基本操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.5.2" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/52-ji-yu-event-time-de-chuang-kou-cao-zuo.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/52-ji-yu-event-time-de-chuang-kou-cao-zuo.html">
            
                    
                    5.2 基于 event-time 的窗口操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.5.3" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/53-ji-yu-watermark-chu-li-yan-chi-shu-ju.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/53-ji-yu-watermark-chu-li-yan-chi-shu-ju.html">
            
                    
                    5.3 基于 Watermark 处理延迟数据
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.5.3.1" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/53-ji-yu-watermark-chu-li-yan-chi-shu-ju/531-update-mo-shi-xia-shi-yong-watermark.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/53-ji-yu-watermark-chu-li-yan-chi-shu-ju/531-update-mo-shi-xia-shi-yong-watermark.html">
            
                    
                    5.3.1 update 模式下使用 watermark
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.5.3.2" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/53-ji-yu-watermark-chu-li-yan-chi-shu-ju/532-append-mo-shi-xia-shi-yong-wartermark.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/53-ji-yu-watermark-chu-li-yan-chi-shu-ju/532-append-mo-shi-xia-shi-yong-wartermark.html">
            
                    
                    5.3.2 append 模式下使用 wartermark
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.5.3.3" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/53-ji-yu-watermark-chu-li-yan-chi-shu-ju/533-watermark-ji-zhi-zong-jie.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/53-ji-yu-watermark-chu-li-yan-chi-shu-ju/533-watermark-ji-zhi-zong-jie.html">
            
                    
                    5.3.3 watermark 机制总结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.5.4" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/54-liu-shu-ju-qu-zhong.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/54-liu-shu-ju-qu-zhong.html">
            
                    
                    5.4 流数据去重
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.5.5" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/54-join-cao-zuo.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/54-join-cao-zuo.html">
            
                    
                    5.5 join 操作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.5.5.1" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/54-join-cao-zuo/541-stream-static-join.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/54-join-cao-zuo/541-stream-static-join.html">
            
                    
                    5.5.1 Stream-static Joins
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.5.5.2" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/54-join-cao-zuo/542-stream-stream-joins.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/54-join-cao-zuo/542-stream-stream-joins.html">
            
                    
                    5.5.2 Stream-stream Joins
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.5.6" data-path="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/56-streaming-dfds-bu-zhi-chi-de-cao-zuo.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-5-zhang-cao-zuo-streaming-dataframe-streaming-dataset/56-streaming-dfds-bu-zhi-chi-de-cao-zuo.html">
            
                    
                    5.6 Streaming DF/DS 不支持的操作
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo.html">
            
                    
                    第 6 章 输出分析结果
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.6.1" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/61-shu-chu-mo-shi.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/61-shu-chu-mo-shi.html">
            
                    
                    6.1 输出模式(output mode)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.6.2" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/62-shu-chu-jie-shou-566828-output-sink.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/62-shu-chu-jie-shou-566828-output-sink.html">
            
                    
                    6.2 输出接收器(output sink)
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.6.2.1" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/62-shu-chu-jie-shou-566828-output-sink/621-file-sink.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/62-shu-chu-jie-shou-566828-output-sink/621-file-sink.html">
            
                    
                    6.2.1 file sink
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.6.2.2" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/62-shu-chu-jie-shou-566828-output-sink/622-kafka-sink.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/62-shu-chu-jie-shou-566828-output-sink/622-kafka-sink.html">
            
                    
                    6.2.2 kafka sink
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.6.2.3" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/63-console-sink.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/63-console-sink.html">
            
                    
                    6.2.3 console sink
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.6.2.4" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/64-memory-sink.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/64-memory-sink.html">
            
                    
                    6.2.4 memory sink
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.6.2.5" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/65-foreach-sink.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/65-foreach-sink.html">
            
                    
                    6.2.5 foreach sink
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.6.2.6" data-path="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/66-foreachbatch-sink.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-6-zhang-shu-chu-fen-xi-jie-guo/66-foreachbatch-sink.html">
            
                    
                    6.2.6 ForeachBatch Sink
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.7" data-path="../../../di-7-bu-fen-structured-streaming/di-7-zhangtrigger-hong-fa-566829.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-7-zhangtrigger-hong-fa-566829.html">
            
                    
                    第 7 章 Trigger(触发器)
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.7.1" data-path="../../../di-7-bu-fen-structured-streaming/di-7-zhangtrigger-hong-fa-566829/71-lian-xu-chu-li-mo-shi.html">
            
                <a href="../../../di-7-bu-fen-structured-streaming/di-7-zhangtrigger-hong-fa-566829/71-lian-xu-chu-li-mo-shi.html">
            
                    
                    7.1 连续处理模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">第 8 部分 Structured Streaming 项目实战</li>
        
        
    
        <li class="chapter " data-level="8.1" data-path="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju.html">
            
                <a href="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju.html">
            
                    
                    第 1 章 准备数据
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.1" data-path="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju/11-shu-ju-sheng-cheng-fang-shi.html">
            
                <a href="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju/11-shu-ju-sheng-cheng-fang-shi.html">
            
                    
                    1.1 数据生成方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.2" data-path="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju/12-shu-ju-sheng-cheng-mo-kuai.html">
            
                <a href="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju/12-shu-ju-sheng-cheng-mo-kuai.html">
            
                    
                    1.2 数据生成模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3" data-path="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju/13-cong-kafka-du-qu-shu-ju.html">
            
                <a href="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-1-zhang-zhun-bei-shu-ju/13-cong-kafka-du-qu-shu-ju.html">
            
                    
                    1.3 从 Kafka 读取数据
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-2-zhang-guang-gao-hei-ming-dan.html">
            
                <a href="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-2-zhang-guang-gao-hei-ming-dan.html">
            
                    
                    第 2 章 广告黑名单实时统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.3" data-path="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-3-zhang-guang-gao-dian-ji-liang-shi-shi-tong-ji.html">
            
                <a href="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-3-zhang-guang-gao-dian-ji-liang-shi-shi-tong-ji.html">
            
                    
                    第 3 章 广告点击量实时统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.4" data-path="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-4-zhang-mei-tian-mei-di-qu-re-men-guang-gao-top3.html">
            
                <a href="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-4-zhang-mei-tian-mei-di-qu-re-men-guang-gao-top3.html">
            
                    
                    第 4 章 每天每地区热门广告 top3 实时统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.5" data-path="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-5-zhang-zui-jin-yi-xiao-shi-guang-gao-dian-ji-liang-shi-shi-tong-ji.html">
            
                <a href="../../../di-8-bu-fen-structured-streaming-xiang-mu-shi-zhan/di-5-zhang-zui-jin-yi-xiao-shi-guang-gao-dian-ji-liang-shi-shi-tong-ji.html">
            
                    
                    第 5 章 最近一小时广告点击量实时统计
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >5.3.1 Value 类型---1</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="531-value-&#x7C7B;&#x578B;---1">5.3.1 Value &#x7C7B;&#x578B;---1</h1>
<h2 id="1-mapfunc">1. <code>map(func)</code></h2>
<p>&#x4F5C;&#x7528;: &#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x65B0;&#x7684; RDD, &#x8BE5; RDD &#x662F;&#x7531;&#x539F; RDD &#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x7ECF;&#x8FC7;&#x51FD;&#x6570;&#x8F6C;&#x6362;&#x540E;&#x7684;&#x503C;&#x800C;&#x7EC4;&#x6210;.  &#x5C31;&#x662F;&#x5BF9; RDD &#x4E2D;&#x7684;&#x6570;&#x636E;&#x505A;&#x8F6C;&#x6362;.  </p>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/map.gif" alt=""></p>
<h3 id="&#x6848;&#x4F8B;">&#x6848;&#x4F8B;:</h3>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5305;&#x542B;<code>1-10</code>&#x7684;&#x7684; RDD&#xFF0C;&#x7136;&#x540E;&#x5C06;<code>&#x6BCF;&#x4E2A;&#x5143;&#x7D20;*2</code>&#x5F62;&#x6210;&#x65B0;&#x7684; RDD</p>
<pre class="language-"><code class="lang-scala">scala <span class="token operator">&gt;</span> <span class="token keyword">val</span> rdd1 <span class="token operator">=</span> sc<span class="token punctuation">.</span>parallelize<span class="token punctuation">(</span><span class="token number">1</span> to <span class="token number">10</span><span class="token punctuation">)</span>
rdd1<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> at parallelize at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>
<span class="token comment">// &#x5F97;&#x5230;&#x4E00;&#x4E2A;&#x65B0;&#x7684; RDD, &#x4F46;&#x662F;&#x8FD9;&#x4E2A; RDD &#x4E2D;&#x7684;&#x5143;&#x7D20;&#x5E76;&#x4E0D;&#x662F;&#x7ACB;&#x5373;&#x8BA1;&#x7B97;&#x51FA;&#x6765;&#x7684;</span>
scala<span class="token operator">&gt;</span> <span class="token keyword">val</span> rdd2 <span class="token operator">=</span> rdd1<span class="token punctuation">.</span>map<span class="token punctuation">(</span>_ <span class="token operator">*</span> <span class="token number">2</span><span class="token punctuation">)</span>
rdd2<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> MapPartitionsRDD<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> at map at
<span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">26</span>

<span class="token comment">// &#x5F00;&#x59CB;&#x8BA1;&#x7B97; rdd2 &#x4E2D;&#x7684;&#x5143;&#x7D20;, &#x5E76;&#x628A;&#x8BA1;&#x7B97;&#x540E;&#x7684;&#x7ED3;&#x679C;&#x4F20;&#x9012;&#x7ED9;&#x9A71;&#x52A8;&#x7A0B;&#x5E8F;</span>
scala<span class="token operator">&gt;</span> rdd2<span class="token punctuation">.</span>collect
res0<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">,</span> <span class="token number">14</span><span class="token punctuation">,</span> <span class="token number">16</span><span class="token punctuation">,</span> <span class="token number">18</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">)</span>
</code></pre>
<h2 id="3-mappartitionswithindexfunc">3. <code>mapPartitionsWithIndex(func)</code></h2>
<p>&#x4F5C;&#x7528;: &#x548C;<code>mapPartitions(func)</code>&#x7C7B;&#x4F3C;. &#x4F46;&#x662F;&#x4F1A;&#x7ED9;<code>func</code>&#x591A;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;<code>Int</code>&#x503C;&#x6765;&#x8868;&#x793A;&#x5206;&#x533A;&#x7684;&#x7D22;&#x5F15;. &#x6240;&#x4EE5;<code>func</code>&#x7684;&#x7C7B;&#x578B;&#x662F;:<code>(Int, Iterator<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>T</span><span class="token punctuation">&gt;</span></span>) =&gt; Iterator<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>U</span><span class="token punctuation">&gt;</span></span></code></p>
<pre class="language-"><code class="lang-scala">
scala<span class="token operator">&gt;</span> <span class="token keyword">val</span> rdd1 <span class="token operator">=</span> sc<span class="token punctuation">.</span>parallelize<span class="token punctuation">(</span>Array<span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">,</span><span class="token number">40</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">,</span><span class="token number">60</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
rdd1<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> at parallelize at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>

scala<span class="token operator">&gt;</span> rdd1<span class="token punctuation">.</span>mapPartitionsWithIndex<span class="token punctuation">(</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> items<span class="token punctuation">)</span> <span class="token keyword">=&gt;</span> items<span class="token punctuation">.</span>map<span class="token punctuation">(</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> _<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
res8<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token punctuation">(</span><span class="token builtin">Int</span><span class="token punctuation">,</span> <span class="token builtin">Int</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> MapPartitionsRDD<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span> at mapPartitionsWithIndex at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">27</span>

scala<span class="token operator">&gt;</span> res8<span class="token punctuation">.</span>collect
res9<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token punctuation">(</span><span class="token builtin">Int</span><span class="token punctuation">,</span> <span class="token builtin">Int</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">40</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">60</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
</code></pre>
<blockquote>
<p>&#x5206;&#x533A;&#x6570;&#x7684;&#x786E;&#x5B9A;, &#x548C;&#x5BF9;&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x5143;&#x7D20;&#x5982;&#x4F55;&#x8FDB;&#x884C;&#x5206;&#x533A;</p>
</blockquote>
<ol>
<li><p>&#x786E;&#x5B9A;&#x5206;&#x533A;&#x6570;:</p>
<pre class="language-"><code class="lang-scala"><span class="token keyword">override</span> <span class="token keyword">def</span> defaultParallelism<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">Int</span> <span class="token operator">=</span>
 scheduler<span class="token punctuation">.</span>conf<span class="token punctuation">.</span>getInt<span class="token punctuation">(</span><span class="token string">&quot;spark.default.parallelism&quot;</span><span class="token punctuation">,</span> totalCores<span class="token punctuation">)</span>
</code></pre>
</li>
<li><p>&#x5BF9;&#x5143;&#x7D20;&#x8FDB;&#x884C;&#x5206;&#x533A;</p>
<pre class="language-"><code class="lang-scala"><span class="token comment">// length: RDD &#x4E2D;&#x6570;&#x636E;&#x7684;&#x957F;&#x5EA6;  numSlices: &#x5206;&#x533A;&#x6570;</span>
<span class="token keyword">def</span> positions<span class="token punctuation">(</span>length<span class="token operator">:</span> <span class="token builtin">Long</span><span class="token punctuation">,</span> numSlices<span class="token operator">:</span> <span class="token builtin">Int</span><span class="token punctuation">)</span><span class="token operator">:</span> Iterator<span class="token punctuation">[</span><span class="token punctuation">(</span><span class="token builtin">Int</span><span class="token punctuation">,</span> <span class="token builtin">Int</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
<span class="token punctuation">(</span><span class="token number">0</span> until numSlices<span class="token punctuation">)</span><span class="token punctuation">.</span>iterator<span class="token punctuation">.</span>map <span class="token punctuation">{</span> i <span class="token keyword">=&gt;</span>
 <span class="token keyword">val</span> start <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>i <span class="token operator">*</span> length<span class="token punctuation">)</span> <span class="token operator">/</span> numSlices<span class="token punctuation">)</span><span class="token punctuation">.</span>toInt
 <span class="token keyword">val</span> end <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">(</span>i <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token operator">*</span> length<span class="token punctuation">)</span> <span class="token operator">/</span> numSlices<span class="token punctuation">)</span><span class="token punctuation">.</span>toInt
 <span class="token punctuation">(</span>start<span class="token punctuation">,</span> end<span class="token punctuation">)</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
seq <span class="token keyword">match</span> <span class="token punctuation">{</span>
<span class="token keyword">case</span> r<span class="token operator">:</span> Range <span class="token keyword">=&gt;</span>

<span class="token keyword">case</span> nr<span class="token operator">:</span> NumericRange<span class="token punctuation">[</span>_<span class="token punctuation">]</span> <span class="token keyword">=&gt;</span>

<span class="token keyword">case</span> _ <span class="token keyword">=&gt;</span>
 <span class="token keyword">val</span> array <span class="token operator">=</span> seq<span class="token punctuation">.</span>toArray <span class="token comment">// To prevent O(n^2) operations for List etc</span>
 positions<span class="token punctuation">(</span>array<span class="token punctuation">.</span>length<span class="token punctuation">,</span> numSlices<span class="token punctuation">)</span><span class="token punctuation">.</span>map <span class="token punctuation">{</span> <span class="token keyword">case</span> <span class="token punctuation">(</span>start<span class="token punctuation">,</span> end<span class="token punctuation">)</span> <span class="token keyword">=&gt;</span>
     array<span class="token punctuation">.</span>slice<span class="token punctuation">(</span>start<span class="token punctuation">,</span> end<span class="token punctuation">)</span><span class="token punctuation">.</span>toSeq
 <span class="token punctuation">}</span><span class="token punctuation">.</span>toSeq
<span class="token punctuation">}</span>
</code></pre>
</li>
</ol>
<hr>
<h2 id="4-flatmapfunc">4. <code>flatMap(func)</code></h2>
<p>&#x4F5C;&#x7528;: &#x7C7B;&#x4F3C;&#x4E8E;<code>map</code>&#xFF0C;&#x4F46;&#x662F;&#x6BCF;&#x4E00;&#x4E2A;&#x8F93;&#x5165;&#x5143;&#x7D20;&#x53EF;&#x4EE5;&#x88AB;&#x6620;&#x5C04;&#x4E3A; 0 &#x6216;&#x591A;&#x4E2A;&#x8F93;&#x51FA;&#x5143;&#x7D20;&#xFF08;&#x6240;&#x4EE5;<code>func</code>&#x5E94;&#x8BE5;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x5E8F;&#x5217;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x5355;&#x4E00;&#x5143;&#x7D20; <code>T =&gt; TraversableOnce[U]</code>&#xFF09;</p>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/flatmap.gif" alt=""></p>
<h3 id="&#x6848;&#x4F8B;">&#x6848;&#x4F8B;:</h3>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x4E3A; 1-5 &#x7684;RDD&#xFF0C;&#x8FD0;&#x7528; <code>flatMap</code>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684; RDD&#xFF0C;&#x65B0;&#x7684; RDD &#x4E3A;&#x539F; RDD 
&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x7684; &#x5E73;&#x65B9;&#x548C;&#x4E09;&#x6B21;&#x65B9; &#x6765;&#x7EC4;&#x6210; <code>1,1,4,8,9,27..</code></p>
<pre class="language-"><code class="lang-scala">scala<span class="token operator">&gt;</span> <span class="token keyword">val</span> rdd1 <span class="token operator">=</span> sc<span class="token punctuation">.</span>parallelize<span class="token punctuation">(</span>Array<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
rdd1<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span> at parallelize at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>

scala<span class="token operator">&gt;</span> rdd1<span class="token punctuation">.</span>flatMap<span class="token punctuation">(</span>x <span class="token keyword">=&gt;</span> Array<span class="token punctuation">(</span>x <span class="token operator">*</span> x<span class="token punctuation">,</span> x <span class="token operator">*</span> x <span class="token operator">*</span> x<span class="token punctuation">)</span><span class="token punctuation">)</span>
res13<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> MapPartitionsRDD<span class="token punctuation">[</span><span class="token number">6</span><span class="token punctuation">]</span> at flatMap at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">27</span>

scala<span class="token operator">&gt;</span> res13<span class="token punctuation">.</span>collect
res14<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">,</span> <span class="token number">9</span><span class="token punctuation">,</span> <span class="token number">27</span><span class="token punctuation">,</span> <span class="token number">16</span><span class="token punctuation">,</span> <span class="token number">64</span><span class="token punctuation">,</span> <span class="token number">25</span><span class="token punctuation">,</span> <span class="token number">125</span><span class="token punctuation">)</span>
</code></pre>
<hr>
<h2 id="5-map&#x548C;mappartition&#x7684;&#x533A;&#x522B;">5. <code>map()</code>&#x548C;<code>mapPartition()</code>&#x7684;&#x533A;&#x522B;</h2>
<ol>
<li><p><code>map()</code>&#xFF1A;&#x6BCF;&#x6B21;&#x5904;&#x7406;&#x4E00;&#x6761;&#x6570;&#x636E;&#x3002;</p>
</li>
<li><p><code>mapPartition()</code>&#xFF1A;&#x6BCF;&#x6B21;&#x5904;&#x7406;&#x4E00;&#x4E2A;&#x5206;&#x533A;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x8FD9;&#x4E2A;&#x5206;&#x533A;&#x7684;&#x6570;&#x636E;&#x5904;&#x7406;&#x5B8C;&#x540E;&#xFF0C;&#x539F; RDD &#x4E2D;&#x8BE5;&#x5206;&#x533A;&#x7684;&#x6570;&#x636E;&#x624D;&#x80FD;&#x91CA;&#x653E;&#xFF0C;&#x53EF;&#x80FD;&#x5BFC;&#x81F4; OOM&#x3002;</p>
</li>
<li><p>&#x5F00;&#x53D1;&#x6307;&#x5BFC;&#xFF1A;&#x5F53;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x8F83;&#x5927;&#x7684;&#x65F6;&#x5019;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;<code>mapPartition()</code>&#xFF0C;&#x4EE5;&#x63D0;&#x9AD8;&#x5904;&#x7406;&#x6548;&#x7387;&#x3002;</p>
</li>
</ol>
<hr>
<h2 id="6-glom">6. <code>glom()</code></h2>
<p>&#x4F5C;&#x7528;: &#x5C06;&#x6BCF;&#x4E00;&#x4E2A;&#x5206;&#x533A;&#x7684;&#x5143;&#x7D20;&#x5408;&#x5E76;&#x6210;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#xFF0C;&#x5F62;&#x6210;&#x65B0;&#x7684; RDD &#x7C7B;&#x578B;&#x662F;<code>RDD[Array[T]]</code></p>
<h3 id="&#x6848;&#x4F8B;">&#x6848;&#x4F8B;</h3>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A; 4 &#x4E2A;&#x5206;&#x533A;&#x7684; RDD&#xFF0C;&#x5E76;&#x5C06;&#x6BCF;&#x4E2A;&#x5206;&#x533A;&#x7684;&#x6570;&#x636E;&#x653E;&#x5230;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;</p>
<pre class="language-"><code class="lang-scala">scala<span class="token operator">&gt;</span> <span class="token keyword">var</span> rdd1 <span class="token operator">=</span> sc<span class="token punctuation">.</span>parallelize<span class="token punctuation">(</span>Array<span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">20</span><span class="token punctuation">,</span><span class="token number">30</span><span class="token punctuation">,</span><span class="token number">40</span><span class="token punctuation">,</span><span class="token number">50</span><span class="token punctuation">,</span><span class="token number">60</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span>
rdd1<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> at parallelize at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>

scala<span class="token operator">&gt;</span> rdd1<span class="token punctuation">.</span>glom<span class="token punctuation">.</span>collect
res2<span class="token operator">:</span> Array<span class="token punctuation">[</span>Array<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span>Array<span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">,</span> Array<span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">,</span> <span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">,</span> Array<span class="token punctuation">(</span><span class="token number">40</span><span class="token punctuation">)</span><span class="token punctuation">,</span> Array<span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">,</span> <span class="token number">60</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
</code></pre>
<hr>
<h2 id="7-groupbyfunc">7. <code>groupBy(func)</code></h2>
<p>&#x4F5C;&#x7528;: </p>
<p>&#x6309;&#x7167;<code>func</code>&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x8FDB;&#x884C;&#x5206;&#x7EC4;.  </p>
<p><code>func</code>&#x8FD4;&#x56DE;&#x503C;&#x4F5C;&#x4E3A; <code>key</code>, &#x5BF9;&#x5E94;&#x7684;&#x503C;&#x653E;&#x5165;&#x4E00;&#x4E2A;&#x8FED;&#x4EE3;&#x5668;&#x4E2D;. &#x8FD4;&#x56DE;&#x7684; RDD: <code>RDD[(K, Iterable[T])</code>  </p>
<p>&#x6BCF;&#x7EC4;&#x5185;&#x5143;&#x7D20;&#x7684;&#x987A;&#x5E8F;&#x4E0D;&#x80FD;&#x4FDD;&#x8BC1;, &#x5E76;&#x4E14;&#x751A;&#x81F3;&#x6BCF;&#x6B21;&#x8C03;&#x7528;&#x5F97;&#x5230;&#x7684;&#x987A;&#x5E8F;&#x4E5F;&#x6709;&#x53EF;&#x80FD;&#x4E0D;&#x540C;.</p>
<h3 id="&#x6848;&#x4F8B;">&#x6848;&#x4F8B;:</h3>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A; RDD&#xFF0C;&#x6309;&#x7167;&#x5143;&#x7D20;&#x7684;&#x5947;&#x5076;&#x6027;&#x8FDB;&#x884C;&#x5206;&#x7EC4;</p>
<pre class="language-"><code class="lang-scala">scala<span class="token operator">&gt;</span> <span class="token keyword">val</span> rdd1 <span class="token operator">=</span> sc<span class="token punctuation">.</span>makeRDD<span class="token punctuation">(</span>Array<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
rdd1<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span> at makeRDD at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>

scala<span class="token operator">&gt;</span> rdd1<span class="token punctuation">.</span>groupBy<span class="token punctuation">(</span>x <span class="token keyword">=&gt;</span> <span class="token keyword">if</span><span class="token punctuation">(</span>x <span class="token operator">%</span> <span class="token number">2</span> <span class="token operator">==</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token string">&quot;odd&quot;</span> <span class="token keyword">else</span> <span class="token string">&quot;even&quot;</span><span class="token punctuation">)</span>
res4<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token punctuation">(</span><span class="token builtin">String</span><span class="token punctuation">,</span> Iterable<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> ShuffledRDD<span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">]</span> at groupBy at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">27</span>

scala<span class="token operator">&gt;</span> res4<span class="token punctuation">.</span>collect
res5<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token punctuation">(</span><span class="token builtin">String</span><span class="token punctuation">,</span> Iterable<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span><span class="token punctuation">(</span>even<span class="token punctuation">,</span>CompactBuffer<span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>odd<span class="token punctuation">,</span>CompactBuffer<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
</code></pre>
<hr>
<h2 id="8-filterfunc">8. <code>filter(func)</code></h2>
<p>&#x4F5C;&#x7528;: &#x8FC7;&#x6EE4;. &#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x65B0;&#x7684; RDD &#x662F;&#x7531;<code>func</code>&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x4E3A;<code>true</code>&#x7684;&#x90A3;&#x4E9B;&#x5143;&#x7D20;&#x7EC4;&#x6210;</p>
<h3 id="&#x6848;&#x4F8B;">&#x6848;&#x4F8B;</h3>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A; RDD&#xFF08;&#x7531;&#x5B57;&#x7B26;&#x4E32;&#x7EC4;&#x6210;&#xFF09;&#xFF0C;&#x8FC7;&#x6EE4;&#x51FA;&#x4E00;&#x4E2A;&#x65B0; RDD&#xFF08;&#x5305;&#x542B;&quot;xiao&quot;&#x5B50;&#x4E32;&#xFF09;</p>
<pre class="language-"><code class="lang-scala">scala<span class="token operator">&gt;</span> <span class="token keyword">val</span> names <span class="token operator">=</span> sc<span class="token punctuation">.</span>parallelize<span class="token punctuation">(</span>Array<span class="token punctuation">(</span><span class="token string">&quot;xiaoli&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;laoli&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;laowang&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;xiaocang&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;xiaojing&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;xiaokong&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
names<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">String</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> at parallelize at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>

scala<span class="token operator">&gt;</span> names<span class="token punctuation">.</span>filter<span class="token punctuation">(</span>_<span class="token punctuation">.</span>contains<span class="token punctuation">(</span><span class="token string">&quot;xiao&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
res3<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">String</span><span class="token punctuation">]</span> <span class="token operator">=</span> MapPartitionsRDD<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> at filter at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">27</span>

scala<span class="token operator">&gt;</span> res3<span class="token punctuation">.</span>collect
res4<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token builtin">String</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span>xiaoli<span class="token punctuation">,</span> xiaocang<span class="token punctuation">,</span> xiaojing<span class="token punctuation">,</span> xiaokong<span class="token punctuation">)</span>
</code></pre>
<hr>
<h2 id="9-samplewithreplacement-fraction-seed">9. <code>sample(withReplacement, fraction, seed)</code></h2>
<p>&#x4F5C;&#x7528;: </p>
<ol>
<li><p>&#x4EE5;&#x6307;&#x5B9A;&#x7684;&#x968F;&#x673A;&#x79CD;&#x5B50;&#x968F;&#x673A;&#x62BD;&#x6837;&#x51FA;&#x6BD4;&#x4F8B;&#x4E3A;<code>fraction</code>&#x7684;&#x6570;&#x636E;&#xFF0C;(&#x62BD;&#x53D6;&#x5230;&#x7684;&#x6570;&#x91CF;&#x662F;: <code>size * fraction</code>). &#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#x5F97;&#x5230;&#x7684;&#x7ED3;&#x679C;&#x5E76;&#x4E0D;&#x80FD;&#x4FDD;&#x8BC1;&#x51C6;&#x786E;&#x7684;&#x6BD4;&#x4F8B;.</p>
</li>
<li><p><code>withReplacement</code>&#x8868;&#x793A;&#x662F;&#x62BD;&#x51FA;&#x7684;&#x6570;&#x636E;&#x662F;&#x5426;&#x653E;&#x56DE;&#xFF0C;<code>true</code>&#x4E3A;&#x6709;&#x653E;&#x56DE;&#x7684;&#x62BD;&#x6837;&#xFF0C;<code>false</code>&#x4E3A;&#x65E0;&#x653E;&#x56DE;&#x7684;&#x62BD;&#x6837;.  &#x653E;&#x56DE;&#x8868;&#x793A;&#x6570;&#x636E;&#x6709;&#x53EF;&#x80FD;&#x4F1A;&#x88AB;&#x91CD;&#x590D;&#x62BD;&#x53D6;&#x5230;, <code>false</code> &#x5219;&#x4E0D;&#x53EF;&#x80FD;&#x91CD;&#x590D;&#x62BD;&#x53D6;&#x5230;.
&#x5982;&#x679C;&#x662F;<code>false</code>, &#x5219;<code>fraction</code>&#x5FC5;&#x987B;&#x662F;:<code>[0,1]</code>, &#x662F; <code>true</code> &#x5219;&#x5927;&#x4E8E;&#x7B49;&#x4E8E;0&#x5C31;&#x53EF;&#x4EE5;&#x4E86;.</p>
</li>
<li><p><code>seed</code>&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x968F;&#x673A;&#x6570;&#x751F;&#x6210;&#x5668;&#x79CD;&#x5B50;&#x3002; &#x4E00;&#x822C;&#x7528;&#x9ED8;&#x8BA4;&#x7684;, &#x6216;&#x8005;&#x4F20;&#x5165;&#x5F53;&#x524D;&#x7684;&#x65F6;&#x95F4;&#x6233;</p>
</li>
</ol>
<h3 id="&#x4E0D;&#x653E;&#x56DE;&#x62BD;&#x6837;">&#x4E0D;&#x653E;&#x56DE;&#x62BD;&#x6837;</h3>
<pre class="language-"><code class="lang-scala">scala<span class="token operator">&gt;</span> <span class="token keyword">val</span> rdd1 <span class="token operator">=</span> sc<span class="token punctuation">.</span>parallelize<span class="token punctuation">(</span><span class="token number">1</span> to <span class="token number">10</span><span class="token punctuation">)</span>
rdd1<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">15</span><span class="token punctuation">]</span> at parallelize at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>

scala<span class="token operator">&gt;</span> rdd1<span class="token punctuation">.</span>sample<span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">)</span><span class="token punctuation">.</span>collect
res15<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">7</span><span class="token punctuation">)</span>
</code></pre>
<h3 id="&#x653E;&#x56DE;&#x62BD;&#x6837;">&#x653E;&#x56DE;&#x62BD;&#x6837;</h3>
<pre class="language-"><code class="lang-scala">scala<span class="token operator">&gt;</span> rdd1<span class="token punctuation">.</span>sample<span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">.</span>collect
res25<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token number">7</span><span class="token punctuation">,</span> <span class="token number">7</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">,</span> <span class="token number">9</span><span class="token punctuation">)</span>
</code></pre>
<hr>
<h2 id="10-distinctnumtasks">10. <code>distinct([numTasks]))</code></h2>
<p>&#x4F5C;&#x7528;: </p>
<p>&#x5BF9; RDD &#x4E2D;&#x5143;&#x7D20;&#x6267;&#x884C;&#x53BB;&#x91CD;&#x64CD;&#x4F5C;. &#x53C2;&#x6570;&#x8868;&#x793A;&#x4EFB;&#x52A1;&#x7684;&#x6570;&#x91CF;.&#x9ED8;&#x8BA4;&#x503C;&#x548C;&#x5206;&#x533A;&#x6570;&#x4FDD;&#x6301;&#x4E00;&#x81F4;.</p>
<pre class="language-"><code class="lang-scala">scala<span class="token operator">&gt;</span> <span class="token keyword">val</span> rdd1 <span class="token operator">=</span> sc<span class="token punctuation">.</span>parallelize<span class="token punctuation">(</span>Array<span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">,</span><span class="token number">9</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
rdd1<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">28</span><span class="token punctuation">]</span> at parallelize at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>

scala<span class="token operator">&gt;</span> rdd1<span class="token punctuation">.</span>distinct<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>collect
res29<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">9</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span>
</code></pre>
<hr>
<h2 id="2-mappartitionsfunc">2. <code>mapPartitions(func)</code></h2>
<p>&#x4F5C;&#x7528;: &#x7C7B;&#x4F3C;&#x4E8E;<code>map(func)</code>, &#x4F46;&#x662F;&#x662F;&#x72EC;&#x7ACB;&#x5728;&#x6BCF;&#x4E2A;&#x5206;&#x533A;&#x4E0A;&#x8FD0;&#x884C;.&#x6240;&#x4EE5;:<code>Iterator<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>T</span><span class="token punctuation">&gt;</span></span> =&gt; Iterator<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>U</span><span class="token punctuation">&gt;</span></span></code></p>
<p>&#x5047;&#x8BBE;&#x6709;<code>N</code>&#x4E2A;&#x5143;&#x7D20;&#xFF0C;&#x6709;<code>M</code>&#x4E2A;&#x5206;&#x533A;&#xFF0C;&#x90A3;&#x4E48;<code>map</code>&#x7684;&#x51FD;&#x6570;&#x7684;&#x5C06;&#x88AB;&#x8C03;&#x7528;<code>N</code>&#x6B21;,&#x800C;<code>mapPartitions</code>&#x88AB;&#x8C03;&#x7528;<code>M</code>&#x6B21;,&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x4E00;&#x6B21;&#x5904;&#x7406;&#x6240;&#x6709;&#x5206;&#x533A;&#x3002;</p>
<pre class="language-"><code class="lang-scala">scala<span class="token operator">&gt;</span> <span class="token keyword">val</span> source <span class="token operator">=</span> sc<span class="token punctuation">.</span>parallelize<span class="token punctuation">(</span><span class="token number">1</span> to <span class="token number">10</span><span class="token punctuation">)</span>
source<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> ParallelCollectionRDD<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span> at parallelize at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">24</span>

scala<span class="token operator">&gt;</span> source<span class="token punctuation">.</span>mapPartitions<span class="token punctuation">(</span>it <span class="token keyword">=&gt;</span> it<span class="token punctuation">.</span>map<span class="token punctuation">(</span>_ <span class="token operator">*</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
res7<span class="token operator">:</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>spark<span class="token punctuation">.</span>rdd<span class="token punctuation">.</span>RDD<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> MapPartitionsRDD<span class="token punctuation">[</span><span class="token number">6</span><span class="token punctuation">]</span> at mapPartitions at <span class="token generics function"><span class="token punctuation">&lt;</span>console<span class="token punctuation">&gt;</span></span><span class="token operator">:</span><span class="token number">27</span>

scala<span class="token operator">&gt;</span> res7<span class="token punctuation">.</span>collect
res8<span class="token operator">:</span> Array<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span> <span class="token operator">=</span> Array<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">,</span> <span class="token number">14</span><span class="token punctuation">,</span> <span class="token number">16</span><span class="token punctuation">,</span> <span class="token number">18</span><span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">)</span>
</code></pre>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x5C1A;&#x7845;&#x8C37;&#x5927;&#x6570;&#x636E; 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification"><br>&#x8BE5;&#x6587;&#x4EF6;&#x6700;&#x540E;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2019-04-28 13:36:23
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../53-rdd-de-zhuan-huan.html" class="navigation navigation-prev " aria-label="Previous page: 5.3 RDD 的转换(transformation)">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="531-value-lei-xing-2.html" class="navigation navigation-next " aria-label="Next page: 5.3.1 Value 类型---2">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"5.3.1 Value 类型---1","level":"2.2.3.1","depth":3,"next":{"title":"5.3.1 Value 类型---2","level":"2.2.3.2","depth":3,"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/531-value-lei-xing-2.md","ref":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/531-value-lei-xing-2.md","articles":[]},"previous":{"title":"5.3 RDD 的转换(transformation)","level":"2.2.3","depth":2,"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan.md","ref":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan.md","articles":[{"title":"5.3.1 Value 类型---1","level":"2.2.3.1","depth":3,"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/531-value-lei-xing.md","ref":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/531-value-lei-xing.md","articles":[]},{"title":"5.3.1 Value 类型---2","level":"2.2.3.2","depth":3,"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/531-value-lei-xing-2.md","ref":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/531-value-lei-xing-2.md","articles":[]},{"title":"5.3.2 双 Value 类型交互","level":"2.2.3.3","depth":3,"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/532-shuang-value-lei-xing.md","ref":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/532-shuang-value-lei-xing.md","articles":[]},{"title":"5.3.3 Key-Value 类型--1","level":"2.2.3.4","depth":3,"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/533-key-value-lei-xing.md","ref":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/533-key-value-lei-xing.md","articles":[]},{"title":"5.3.3 Key-Value 类型---2","level":"2.2.3.5","depth":3,"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/533-key-value-lei-578b-2.md","ref":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/533-key-value-lei-578b-2.md","articles":[]},{"title":"5.3.4 案例实操","level":"2.2.3.6","depth":3,"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/534-an-li-shi-cao.md","ref":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/534-an-li-shi-cao.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["splitter","expandable-chapters-small","page-toc-button","-highlight","prism","prism-themes","tbfed-pagefooter","sitemap","change_girls","livereload"],"styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 尚硅谷大数据 2019","modify_label":"<br>该文件最后修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prismjs/themes/prism-solarizedlight.css"]},"disqus":{"shortName":"zhenchao125"},"livereload":{},"splitter":{},"change_girls":{"time":30,"urls":["http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/62171757.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/83394736.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/15906185.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/15906185.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/3394270.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/65028582.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/20359261.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/37472401.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/3355397.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/11075549.jpg-atguiguImg"]},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"sitemap":{"hostname":"http://bigdataatguigu.applinzi.com/"},"page-toc-button":{"maxTocDepth":3,"minTocSize":2},"prism-themes":{},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":" 李振超","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"大数据 bigdata_spark_atguigu 课堂笔记","language":"zh-hans","links":{"sidebar":{"联系我们":"http://www.atguigu.com/"}},"gitbook":"*","description":"课堂笔记,学生提前预习"},"file":{"path":"di-2-bu-fen-spark-core/di-5-zhang-rdd-bian-cheng/53-rdd-de-zhuan-huan/531-value-lei-xing.md","mtime":"2019-04-28T05:36:23.540Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-09-11T00:27:54.977Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="../../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-change_girls/girls.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

